# 这是最终版本
BIN=myproc
CC=gcc

#SRC=$(shell ls *.c)
SRC=$(wildcard *.c)

OBJ=$(SRC:.c=.o)
LinkFLAGS=-o
FLAGS=-c
RM=rm -rf

$(BIN):$(OBJ)
	@$(CC) $(LinkFLAGS) $@ $^
	@echo "Linking ... $^ to $@"
%.o:%.c
	@$(CC) $(FLAGS) $<
	@echo "compling ... $< to $@"

.PHONY:clean
clean:
	@$(RM) $(OBJ) $(BIN)
	@echo "remove ... $(RM) $(BIN)"

.PHONY:test
test:
	@echo $(SRC)



#BIN=myproc
#CC=gcc
#SRC=myproc.c
#OBJ=myproc.o
#LinkFLAGS=-o
#FLAGS=-c
#RM=rm -rf
#
#$(BIN):$(OBJ)
#	@$(CC) $(LinkFLAGS) $@ $^
#	@echo "Linking ... $^ to $@"
#%.o:%.c
#	@$(CC) $(FLAGS) $<
#	@echo "compling ... $< to $@"
#
#.PHONY:clean
#clean:
#	@$(RM) $(OBJ) $(BIN)
#	@echo "remove ... $(RM) $(BIN)"
#


#BIN=myproc
#CC=gcc
#SRC=myproc.c
#FLAGS=-o
#RM=rm -rf
#
#$(BIN):$(SRC)
#	@$(CC) $(FLAGS) $@ $^
#.PHONY:
#clean:
#	@$(RM) $(BIN)
#
#.PHONY:test
#test:
#	@echo $(BIN)
#	@echo $(CC)
#	@echo $(SRC)
#	@echo $(FLAGS)
#	@echo $(RM)




#myproc:myproc.c
#	gcc -o myproc myproc.c
